Optimal. Leaf size=184 \[ -\frac {\log \left (d+e x+f x^2\right ) \left (A f (c e-b f)-B \left (a f^2-b e f-c d f+c e^2\right )\right )}{2 f^3}-\frac {\tanh ^{-1}\left (\frac {e+2 f x}{\sqrt {e^2-4 d f}}\right ) \left (A f \left (2 a f^2-b e f-2 c d f+c e^2\right )+B \left (f \left (-a e f-2 b d f+b e^2\right )-c \left (e^3-3 d e f\right )\right )\right )}{f^3 \sqrt {e^2-4 d f}}-\frac {x (-A c f-b B f+B c e)}{f^2}+\frac {B c x^2}{2 f} \]
________________________________________________________________________________________
Rubi [A] time = 0.35, antiderivative size = 182, normalized size of antiderivative = 0.99, number of steps used = 6, number of rules used = 5, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.179, Rules used = {1628, 634, 618, 206, 628} \begin {gather*} -\frac {\log \left (d+e x+f x^2\right ) \left (B f (b e-a f)+A f (c e-b f)-B c \left (e^2-d f\right )\right )}{2 f^3}-\frac {\tanh ^{-1}\left (\frac {e+2 f x}{\sqrt {e^2-4 d f}}\right ) \left (A f \left (2 a f^2-b e f-2 c d f+c e^2\right )+B f \left (-a e f-2 b d f+b e^2\right )-B c \left (e^3-3 d e f\right )\right )}{f^3 \sqrt {e^2-4 d f}}-\frac {x (-A c f-b B f+B c e)}{f^2}+\frac {B c x^2}{2 f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 206
Rule 618
Rule 628
Rule 634
Rule 1628
Rubi steps
\begin {align*} \int \frac {(A+B x) \left (a+b x+c x^2\right )}{d+e x+f x^2} \, dx &=\int \left (-\frac {B c e-b B f-A c f}{f^2}+\frac {B c x}{f}+\frac {-A f (c d-a f)+B d (c e-b f)-\left (B f (b e-a f)+A f (c e-b f)-B c \left (e^2-d f\right )\right ) x}{f^2 \left (d+e x+f x^2\right )}\right ) \, dx\\ &=-\frac {(B c e-b B f-A c f) x}{f^2}+\frac {B c x^2}{2 f}+\frac {\int \frac {-A f (c d-a f)+B d (c e-b f)-\left (B f (b e-a f)+A f (c e-b f)-B c \left (e^2-d f\right )\right ) x}{d+e x+f x^2} \, dx}{f^2}\\ &=-\frac {(B c e-b B f-A c f) x}{f^2}+\frac {B c x^2}{2 f}+\frac {\left (-B f (b e-a f)-A f (c e-b f)+B c \left (e^2-d f\right )\right ) \int \frac {e+2 f x}{d+e x+f x^2} \, dx}{2 f^3}+\frac {\left (B f \left (b e^2-2 b d f-a e f\right )-B c \left (e^3-3 d e f\right )+A f \left (c e^2-2 c d f-b e f+2 a f^2\right )\right ) \int \frac {1}{d+e x+f x^2} \, dx}{2 f^3}\\ &=-\frac {(B c e-b B f-A c f) x}{f^2}+\frac {B c x^2}{2 f}-\frac {\left (B f (b e-a f)+A f (c e-b f)-B c \left (e^2-d f\right )\right ) \log \left (d+e x+f x^2\right )}{2 f^3}-\frac {\left (B f \left (b e^2-2 b d f-a e f\right )-B c \left (e^3-3 d e f\right )+A f \left (c e^2-2 c d f-b e f+2 a f^2\right )\right ) \operatorname {Subst}\left (\int \frac {1}{e^2-4 d f-x^2} \, dx,x,e+2 f x\right )}{f^3}\\ &=-\frac {(B c e-b B f-A c f) x}{f^2}+\frac {B c x^2}{2 f}-\frac {\left (B f \left (b e^2-2 b d f-a e f\right )-B c \left (e^3-3 d e f\right )+A f \left (c e^2-2 c d f-b e f+2 a f^2\right )\right ) \tanh ^{-1}\left (\frac {e+2 f x}{\sqrt {e^2-4 d f}}\right )}{f^3 \sqrt {e^2-4 d f}}-\frac {\left (B f (b e-a f)+A f (c e-b f)-B c \left (e^2-d f\right )\right ) \log \left (d+e x+f x^2\right )}{2 f^3}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.21, size = 175, normalized size = 0.95 \begin {gather*} \frac {\log (d+x (e+f x)) \left (B f (a f-b e)+A f (b f-c e)+B c \left (e^2-d f\right )\right )-\frac {2 \tan ^{-1}\left (\frac {e+2 f x}{\sqrt {4 d f-e^2}}\right ) \left (A f \left (-2 a f^2+b e f+2 c d f-c e^2\right )+B f \left (a e f+2 b d f-b e^2\right )+B c \left (e^3-3 d e f\right )\right )}{\sqrt {4 d f-e^2}}+2 f x (A c f+b B f-B c e)+B c f^2 x^2}{2 f^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
IntegrateAlgebraic [F] time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {(A+B x) \left (a+b x+c x^2\right )}{d+e x+f x^2} \, dx \end {gather*}
Verification is not applicable to the result.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.44, size = 583, normalized size = 3.17 \begin {gather*} \left [\frac {{\left (B c e^{2} f^{2} - 4 \, B c d f^{3}\right )} x^{2} - {\left (B c e^{3} - 2 \, A a f^{3} + {\left (2 \, {\left (B b + A c\right )} d + {\left (B a + A b\right )} e\right )} f^{2} - {\left (3 \, B c d e + {\left (B b + A c\right )} e^{2}\right )} f\right )} \sqrt {e^{2} - 4 \, d f} \log \left (\frac {2 \, f^{2} x^{2} + 2 \, e f x + e^{2} - 2 \, d f - \sqrt {e^{2} - 4 \, d f} {\left (2 \, f x + e\right )}}{f x^{2} + e x + d}\right ) - 2 \, {\left (B c e^{3} f + 4 \, {\left (B b + A c\right )} d f^{3} - {\left (4 \, B c d e + {\left (B b + A c\right )} e^{2}\right )} f^{2}\right )} x + {\left (B c e^{4} - 4 \, {\left (B a + A b\right )} d f^{3} + {\left (4 \, B c d^{2} + 4 \, {\left (B b + A c\right )} d e + {\left (B a + A b\right )} e^{2}\right )} f^{2} - {\left (5 \, B c d e^{2} + {\left (B b + A c\right )} e^{3}\right )} f\right )} \log \left (f x^{2} + e x + d\right )}{2 \, {\left (e^{2} f^{3} - 4 \, d f^{4}\right )}}, \frac {{\left (B c e^{2} f^{2} - 4 \, B c d f^{3}\right )} x^{2} + 2 \, {\left (B c e^{3} - 2 \, A a f^{3} + {\left (2 \, {\left (B b + A c\right )} d + {\left (B a + A b\right )} e\right )} f^{2} - {\left (3 \, B c d e + {\left (B b + A c\right )} e^{2}\right )} f\right )} \sqrt {-e^{2} + 4 \, d f} \arctan \left (-\frac {\sqrt {-e^{2} + 4 \, d f} {\left (2 \, f x + e\right )}}{e^{2} - 4 \, d f}\right ) - 2 \, {\left (B c e^{3} f + 4 \, {\left (B b + A c\right )} d f^{3} - {\left (4 \, B c d e + {\left (B b + A c\right )} e^{2}\right )} f^{2}\right )} x + {\left (B c e^{4} - 4 \, {\left (B a + A b\right )} d f^{3} + {\left (4 \, B c d^{2} + 4 \, {\left (B b + A c\right )} d e + {\left (B a + A b\right )} e^{2}\right )} f^{2} - {\left (5 \, B c d e^{2} + {\left (B b + A c\right )} e^{3}\right )} f\right )} \log \left (f x^{2} + e x + d\right )}{2 \, {\left (e^{2} f^{3} - 4 \, d f^{4}\right )}}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.17, size = 191, normalized size = 1.04 \begin {gather*} \frac {B c f x^{2} + 2 \, B b f x + 2 \, A c f x - 2 \, B c x e}{2 \, f^{2}} - \frac {{\left (B c d f - B a f^{2} - A b f^{2} + B b f e + A c f e - B c e^{2}\right )} \log \left (f x^{2} + x e + d\right )}{2 \, f^{3}} - \frac {{\left (2 \, B b d f^{2} + 2 \, A c d f^{2} - 2 \, A a f^{3} - 3 \, B c d f e + B a f^{2} e + A b f^{2} e - B b f e^{2} - A c f e^{2} + B c e^{3}\right )} \arctan \left (\frac {2 \, f x + e}{\sqrt {4 \, d f - e^{2}}}\right )}{\sqrt {4 \, d f - e^{2}} f^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [B] time = 0.01, size = 510, normalized size = 2.77 \begin {gather*} \frac {2 A a \arctan \left (\frac {2 f x +e}{\sqrt {4 d f -e^{2}}}\right )}{\sqrt {4 d f -e^{2}}}-\frac {A b e \arctan \left (\frac {2 f x +e}{\sqrt {4 d f -e^{2}}}\right )}{\sqrt {4 d f -e^{2}}\, f}-\frac {2 A c d \arctan \left (\frac {2 f x +e}{\sqrt {4 d f -e^{2}}}\right )}{\sqrt {4 d f -e^{2}}\, f}+\frac {A c \,e^{2} \arctan \left (\frac {2 f x +e}{\sqrt {4 d f -e^{2}}}\right )}{\sqrt {4 d f -e^{2}}\, f^{2}}-\frac {B a e \arctan \left (\frac {2 f x +e}{\sqrt {4 d f -e^{2}}}\right )}{\sqrt {4 d f -e^{2}}\, f}-\frac {2 B b d \arctan \left (\frac {2 f x +e}{\sqrt {4 d f -e^{2}}}\right )}{\sqrt {4 d f -e^{2}}\, f}+\frac {B b \,e^{2} \arctan \left (\frac {2 f x +e}{\sqrt {4 d f -e^{2}}}\right )}{\sqrt {4 d f -e^{2}}\, f^{2}}+\frac {3 B c d e \arctan \left (\frac {2 f x +e}{\sqrt {4 d f -e^{2}}}\right )}{\sqrt {4 d f -e^{2}}\, f^{2}}-\frac {B c \,e^{3} \arctan \left (\frac {2 f x +e}{\sqrt {4 d f -e^{2}}}\right )}{\sqrt {4 d f -e^{2}}\, f^{3}}+\frac {B c \,x^{2}}{2 f}+\frac {A b \ln \left (f \,x^{2}+e x +d \right )}{2 f}-\frac {A c e \ln \left (f \,x^{2}+e x +d \right )}{2 f^{2}}+\frac {A c x}{f}+\frac {B a \ln \left (f \,x^{2}+e x +d \right )}{2 f}-\frac {B b e \ln \left (f \,x^{2}+e x +d \right )}{2 f^{2}}+\frac {B b x}{f}-\frac {B c d \ln \left (f \,x^{2}+e x +d \right )}{2 f^{2}}+\frac {B c \,e^{2} \ln \left (f \,x^{2}+e x +d \right )}{2 f^{3}}-\frac {B c e x}{f^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 3.85, size = 273, normalized size = 1.48 \begin {gather*} x\,\left (\frac {A\,c+B\,b}{f}-\frac {B\,c\,e}{f^2}\right )-\frac {\ln \left (f\,x^2+e\,x+d\right )\,\left (B\,c\,e^4-4\,A\,b\,d\,f^3-4\,B\,a\,d\,f^3-A\,c\,e^3\,f-B\,b\,e^3\,f+A\,b\,e^2\,f^2+B\,a\,e^2\,f^2+4\,B\,c\,d^2\,f^2+4\,A\,c\,d\,e\,f^2+4\,B\,b\,d\,e\,f^2-5\,B\,c\,d\,e^2\,f\right )}{2\,\left (4\,d\,f^4-e^2\,f^3\right )}-\frac {\mathrm {atan}\left (\frac {e}{\sqrt {4\,d\,f-e^2}}+\frac {2\,f\,x}{\sqrt {4\,d\,f-e^2}}\right )\,\left (B\,c\,e^3-2\,A\,a\,f^3+A\,b\,e\,f^2+2\,A\,c\,d\,f^2+B\,a\,e\,f^2+2\,B\,b\,d\,f^2-A\,c\,e^2\,f-B\,b\,e^2\,f-3\,B\,c\,d\,e\,f\right )}{f^3\,\sqrt {4\,d\,f-e^2}}+\frac {B\,c\,x^2}{2\,f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [B] time = 16.65, size = 1260, normalized size = 6.85 \begin {gather*} \frac {B c x^{2}}{2 f} + x \left (\frac {A c}{f} + \frac {B b}{f} - \frac {B c e}{f^{2}}\right ) + \left (- \frac {\sqrt {- 4 d f + e^{2}} \left (- 2 A a f^{3} + A b e f^{2} + 2 A c d f^{2} - A c e^{2} f + B a e f^{2} + 2 B b d f^{2} - B b e^{2} f - 3 B c d e f + B c e^{3}\right )}{2 f^{3} \left (4 d f - e^{2}\right )} + \frac {A b f^{2} - A c e f + B a f^{2} - B b e f - B c d f + B c e^{2}}{2 f^{3}}\right ) \log {\left (x + \frac {- A a e f^{2} + 2 A b d f^{2} - A c d e f + 2 B a d f^{2} - B b d e f - 2 B c d^{2} f + B c d e^{2} - 4 d f^{3} \left (- \frac {\sqrt {- 4 d f + e^{2}} \left (- 2 A a f^{3} + A b e f^{2} + 2 A c d f^{2} - A c e^{2} f + B a e f^{2} + 2 B b d f^{2} - B b e^{2} f - 3 B c d e f + B c e^{3}\right )}{2 f^{3} \left (4 d f - e^{2}\right )} + \frac {A b f^{2} - A c e f + B a f^{2} - B b e f - B c d f + B c e^{2}}{2 f^{3}}\right ) + e^{2} f^{2} \left (- \frac {\sqrt {- 4 d f + e^{2}} \left (- 2 A a f^{3} + A b e f^{2} + 2 A c d f^{2} - A c e^{2} f + B a e f^{2} + 2 B b d f^{2} - B b e^{2} f - 3 B c d e f + B c e^{3}\right )}{2 f^{3} \left (4 d f - e^{2}\right )} + \frac {A b f^{2} - A c e f + B a f^{2} - B b e f - B c d f + B c e^{2}}{2 f^{3}}\right )}{- 2 A a f^{3} + A b e f^{2} + 2 A c d f^{2} - A c e^{2} f + B a e f^{2} + 2 B b d f^{2} - B b e^{2} f - 3 B c d e f + B c e^{3}} \right )} + \left (\frac {\sqrt {- 4 d f + e^{2}} \left (- 2 A a f^{3} + A b e f^{2} + 2 A c d f^{2} - A c e^{2} f + B a e f^{2} + 2 B b d f^{2} - B b e^{2} f - 3 B c d e f + B c e^{3}\right )}{2 f^{3} \left (4 d f - e^{2}\right )} + \frac {A b f^{2} - A c e f + B a f^{2} - B b e f - B c d f + B c e^{2}}{2 f^{3}}\right ) \log {\left (x + \frac {- A a e f^{2} + 2 A b d f^{2} - A c d e f + 2 B a d f^{2} - B b d e f - 2 B c d^{2} f + B c d e^{2} - 4 d f^{3} \left (\frac {\sqrt {- 4 d f + e^{2}} \left (- 2 A a f^{3} + A b e f^{2} + 2 A c d f^{2} - A c e^{2} f + B a e f^{2} + 2 B b d f^{2} - B b e^{2} f - 3 B c d e f + B c e^{3}\right )}{2 f^{3} \left (4 d f - e^{2}\right )} + \frac {A b f^{2} - A c e f + B a f^{2} - B b e f - B c d f + B c e^{2}}{2 f^{3}}\right ) + e^{2} f^{2} \left (\frac {\sqrt {- 4 d f + e^{2}} \left (- 2 A a f^{3} + A b e f^{2} + 2 A c d f^{2} - A c e^{2} f + B a e f^{2} + 2 B b d f^{2} - B b e^{2} f - 3 B c d e f + B c e^{3}\right )}{2 f^{3} \left (4 d f - e^{2}\right )} + \frac {A b f^{2} - A c e f + B a f^{2} - B b e f - B c d f + B c e^{2}}{2 f^{3}}\right )}{- 2 A a f^{3} + A b e f^{2} + 2 A c d f^{2} - A c e^{2} f + B a e f^{2} + 2 B b d f^{2} - B b e^{2} f - 3 B c d e f + B c e^{3}} \right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________